﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WMS_Goodsinfo.Api.Write.Application.Command.商品;
using WMS_Goodsinfo.ErrorCode;

namespace WMS_Goodsinfo.Api.Write.Controllers
{
    /// <summary>
    /// 商品仓库服务
    /// </summary>
    [Route("api/[controller][action]")]
    [ApiController]
    public class ProductController : ControllerBase
    {
        private readonly IMediator _mediator;

        public ProductController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 添加商品信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<ApiResult<int>> AddProduct(CreateProductCommand request)
        {
            return _mediator.Send(request);
        }
        /// <summary>
        /// 新增出入库流水
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<ApiResult<int>> AddInout(CreateInoutCommand request)
        {
            return _mediator.Send(request);
        }
        /// <summary>
        /// 添加库存
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<ApiResult<int>> Addwarehouse(CreateWarehouseCommand request)
        {
            return _mediator.Send(request);
        }
    }
}
